Conversation
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 16/edge #852 +/- ##
===========================================
- Coverage 71.03% 70.83% -0.21%
===========================================
Files 15 15
Lines 3870 3888 +18
Branches 571 580 +9
===========================================
+ Hits 2749 2754 +5
- Misses 938 949 +11
- Partials 183 185 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…ools Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
| if temp_location is not None: | ||
| cursor.execute("SELECT TRUE FROM pg_tablespace WHERE spcname='temp';") | ||
| if cursor.fetchone() is None: | ||
| cursor.execute(f"CREATE TABLESPACE temp LOCATION '{temp_location}';") | ||
| cursor.execute("GRANT CREATE ON TABLESPACE temp TO public;") |
There was a problem hiding this comment.
Configure PostgreSQL to use the temp storage for temporary tablespaces.
| if len(data_directory_contents) == 1 and data_directory_contents[0] == "pg_wal": | ||
| os.remove(os.path.join(POSTGRESQL_DATA_PATH, "pg_wal")) | ||
| logger.info("PostgreSQL data directory was not empty. Removed pg_wal") | ||
| return True |
There was a problem hiding this comment.
This was needed for async replication, when sometimes the pg_wal folder got recreated at some point with old data.
| initdb: | ||
| - encoding: UTF8 | ||
| - data-checksums | ||
| - waldir: /var/snap/charmed-postgresql/common/data/logs |
There was a problem hiding this comment.
Mapping the WAL directory to the logs storage in the primary.
| basebackup: | ||
| - waldir: /var/snap/charmed-postgresql/common/data/logs |
There was a problem hiding this comment.
Mapping the WAL directory to the logs storage in the replicas.
| ssl_cert_file: {{ conf_path }}/cert.pem | ||
| ssl_key_file: {{ conf_path }}/key.pem | ||
| {%- endif %} | ||
| temp_tablespaces: temp |
There was a problem hiding this comment.
Configure PostgreSQL to use the temp storage for temporary tablespaces.
| logger.info("Checking charm storages") | ||
| expected_storages = ["archive", "data", "logs", "temp"] | ||
| storages = await ops_test.model.list_storage() | ||
| assert len(storages) == 4, f"Expected 4 storages, got: {len(storages)}" | ||
| for index, storage in enumerate(storages): | ||
| assert ( | ||
| storage["attachments"]["unit-postgresql-0"].__dict__["storage_tag"] | ||
| == f"storage-{expected_storages[index]}-{index}" | ||
| ), f"Storage {expected_storages[index]} not found" |
There was a problem hiding this comment.
Testing the presence of multiple storages.
| async def test_deploy_latest(ops_test: OpsTest) -> None: | ||
| """Simple test to ensure that the PostgreSQL and application charms get deployed.""" | ||
| await ops_test.model.deploy( | ||
| await ops_test.juju( |
There was a problem hiding this comment.
This will be rolled back as soon as a revision is published to the 16/edge channel.
| async def test_deploy_stable(ops_test: OpsTest) -> None: | ||
| """Simple test to ensure that the PostgreSQL and application charms get deployed.""" | ||
| await ops_test.model.deploy( | ||
| await ops_test.juju( |
There was a problem hiding this comment.
This will be rolled back as soon as a revision is published to the 16/beta channel.
taurus-forever
left a comment
There was a problem hiding this comment.
IMHI, we can merge this tested PR and rediscuss binaries on Monday.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…ools Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Issue
The new PG 16 charm needs 4 different storage areas to separate the different kinds of data produced by the database system. More details are explained at DPE-2603.
Solution
Modify the charm to have 4 different storages instead of 1 and adapt the charm code to configure PostgreSQL to use 3 of them (data, logs and temp) for the needed purposes and keep the last one (archive) for local backups.
Notes:
Checklist